<template>
  <div>
      <el-bread></el-bread>
      <el-button class="ctn" type="primary" size="small" @click="add" plain>添加</el-button>
      <v-list @edit="edit"></v-list>
      <v-diang ref="dialogInfo" :info="info" @cancel="cancel"></v-diang>
  </div>
</template>

<script>
import vList from './list.vue'
import vDiang from './dialog.vue'
export default {
  data() {
      return {
          info:{
              // 控制弹框
              isShow:false,
              //告诉是添加还是编辑
              isAdd:true,
          }
      }
  },
  methods:{
      // 添加
      add(){
          this.info.isShow = true;
          this.info.isAdd = true;
      },
      // 编辑
      edit(e){
          this.info.isShow = true;
          this.info.isAdd = false;
          this.$refs.dialogInfo.lookup(e)
      },
      // 取消
      cancel(e){
          this.info.isShow = e
      }
  },
  components:{
      vDiang,
      vList
  }
};
</script>

<style scoped>
.ctn {
  margin-top: 10px;
  margin-bottom: 10px;
}
</style>
